﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <title>Edit</title>
    <link href="~/Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" />
    <link href="~/Scripts/ligerUI/skins/ligerui-icons.css" rel="stylesheet" />
    <link href="~/Scripts/ligerUI/skins/Gray/css/all.css" rel="stylesheet" />
    <link href="~/Content/css/common.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script src="~/Scripts/ligerUI/js/ligerui.all.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
</head>
<body>
    <div style="margin:10px 0px;">
        <table class="gridtable">
            <tr>
                <td style="text-align:right; width:100px;">
                    主题名称：
                </td>
                <td>
                    <input type="text" id="txtTitle_Name" class="l-text" style="width:200px;" maxlength="50" /><font style="color:red;">&nbsp;*</font>
                </td>
            </tr>
            <tr>
                <td style="text-align:right; width:100px;">
                    排序序号：
                </td>
                <td>
                    <input type="text" id="txtFather_Sort" class="l-text" style="width:200px;text-align:left;" maxlength="10" />
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center;padding-top:10px;">
                    <input id="btnSubmit" type="button" value="确定" class="l-button" onclick="save()" />&nbsp;&nbsp;&nbsp;
                    <input id="btnCancel" type="button" value="取消" class="l-button" onclick="closeDialog()" />
                </td>
            </tr>
            <tr></tr>
        </table>
        <input type="hidden" id="hdnId" value="@(ViewBag.Id)" />
    </div>
</body>
</html>
<script>
    $(function () {
        $("#txtFather_Sort").ligerTextBox({ digits: true });
        dialog = frameElement.dialog;
        $("#txtTitle_Name").val(dialog.get('data').Title_Name);
        $("#txtFather_Sort").val(dialog.get('data').Father_Sort);
    });

    function save() {
        var ID = $("#hdnId").val();
        var Medical_ID = parent.$("#hdnMedicalId").val();
        var Medical_Name = parent.$("#ddlMedical").ligerComboBox().getText();
        var Title_Name = $("#txtTitle_Name").val();
        var Father_Sort = $("#txtFather_Sort").val();


        if (IsEmpty(Title_Name)) {
            $.ligerDialog.error("主题名称不能为空");
            $("#txtTitle_Name").focus();
            return;
        }

        var jsonInfo = {
            ID: ID,
            Medical_ID: Medical_ID,
            Medical_Name: Medical_Name,
            Title_Name: Title_Name,
            Father_Sort: Father_Sort
        };

        $.ajax({
            url: "/ChestPainCenter/MedicalRecordSet/Save",
            type: "post",
            data: { data: JSON.stringify(jsonInfo) },
            success: function (r) {
                var r = $.parseJSON(r);
                if (r.Result == 1) {
                    $.ligerDialog.success("保存成功", "",
                        function () {
                            parent.$("#btnSearch").click();
                            closeDialog();
                        }, { allowClose: false });
                }
                else if (r.Result == 0) {
                    $.ligerDialog.error(r.Body);
                }
                else {
                    $.ligerDialog.error("程序错误");
                }
            },
            error: function () {
                $.ligerDialog.error("程序错误");
            }
        });
    }
</script>
